class Person(object):  # 声明一个类，所有类的最上层都是object类型

    num = 0  # 类属性，记录创建了几个对象

    def __init__(self, name):  # 构造方法
        self.name = name
        Person.num += 1

    def show(self):
        print("我的名字叫%s" % self.name)

    @classmethod
    def get_num(cls):
        print("当前实例个数%d" % cls.num)

    @staticmethod
    def say_ok():
        print("ok")


class Student(Person):
    def __init__(self, name, age):
        super().__init__(name)
        self.age = age

    def show(self):
        print("我是学生%s,%d岁了" % (self.name, self.age))


def show(a):
    a.show()


s = Student("张三", 12)
p = Person("张三")  # 创建一个实例
show(s)
show(p)

s.show()
print(isinstance(s, Student))
print(isinstance(s, Person))
print(isinstance(s, object))

p1 = Person("李四")
Person.say_ok()
Person.get_num()
p.show()
p1.show()
print(Person.num)
print(p.name, p1.name)
print(p.__dict__, p1.__dict__)  # 获取所有属性
print(isinstance(p, Person))
print(isinstance(p, object))
